package com.yjd.comm.sms.convert;

import java.util.List;

import com.yjd.comm.enums.SelectEnum;
import com.yjd.comm.sms.enums.SmsStatusEnum;
import com.yjd.comm.sms.model.SmsTemplateModel;
import com.yjd.comm.util.DateUtil;

/**
 * <b>description</b>：短信模板数据转换器 <br>
 * <b>time</b>：2014-10-16上午11:45:11 <br>
 * <b>author</b>： ready likun_557@163.com
 */
public class SmsTemplateModelConvert {
	public static SmsTemplateModel convert(SmsTemplateModel model)
			throws Exception {
		if (model != null) {
			model.getStrMap().put(
					"createTime",
					DateUtil.timestampToDateString(model.getCreateTime(),
							DateUtil.PATTERN_yyyy_MM_dd_HH_mm_ss));
			model.getStrMap().put("is_then_send",
					SelectEnum.getDesc(model.getIs_then_send()));
		}
		return model;
	}

	public static List<SmsTemplateModel> convert(List<SmsTemplateModel> models)
			throws Exception {
		if (models == null || models.size() == 0) {
			return models;
		}
		for (SmsTemplateModel model : models) {
			convert(model);
		}
		return models;
	}

}
